package controller

import (
	"project1/service"
	"project1/validate"

	"github.com/kataras/iris/v12"
)

type BusinessController struct {
	BaseController
	Service *service.BusinessService
}

// 构造函数
func NewBusinessController() *BusinessController {
	return &BusinessController{
		BaseController: *NewBaseController(),
	}
}

// 查询账号列表
func (e *BusinessController) GetAccountList(ctx iris.Context) {
	bodyData := validate.AccountListParam{}
	err := e.ValidateParams.CheckStructParams(ctx.FormValues(), map[string][]string{
		"int": {"businessId", "status", "onlineStatus", "expireStatus"},
	}, &bodyData)
	if err != nil {
		e.ApiReturn(ctx, "", err)
		return
	}
	data, err := e.Service.GetAccountList(bodyData)
	e.ApiReturn(ctx, data, err)
}
